package com.lanhai.longheng;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
 
import com.lanhai.longheng.listener.AgvListener;
import com.lanhai.longheng.listener.DeviceListener;
import com.lanhai.longheng.listener.HackListener;
import com.lanhai.longheng.report.AgvStateThread;

/**
 * 各种侦听管理
 * @author zhengwei
 *
 */
@Component
public class ListenerManager {
	@Autowired
	AgvListener agvListener;
	
	@Autowired
	DeviceListener deviceListener;
	
	@Autowired
	DeviceListener SEListener;
	
	WebSocketCore websocket;
	
	@Autowired
	HackListener hackListener;
	
	@Autowired
	AgvStateThread agvStateListener;
	
	MsgCore msgCore;
	
	
	
	public void start() { 
		agvListener.Start(5000);
		deviceListener.Start(9700);
		SEListener.Start(8090);
		hackListener.Start();
	    agvStateListener.Start(1);
	    msgCore=new MsgCore( "10.23.101.200");
	     msgCore.Start();
	}
	
	public void stop() {
		agvListener.Stop();
		deviceListener.Stop();
		SEListener.Stop();
		hackListener.Stop();
	    agvStateListener.Stop();
	    msgCore.Stop(); 
	}

	@Override
	protected void finalize() throws Throwable {
		stop(); 
	}
	
	
}
